package cn.edu.baiyunu.myapplication.di

import cn.edu.baiyunu.myapplication.data.repository.CategoryRepository
import cn.edu.baiyunu.myapplication.data.repository.CategoryRepositoryImpl
import cn.edu.baiyunu.myapplication.data.repository.SavingsGoalRepository
import cn.edu.baiyunu.myapplication.data.repository.SavingsGoalRepositoryImpl
import cn.edu.baiyunu.myapplication.data.repository.SettingsRepository
import cn.edu.baiyunu.myapplication.data.repository.SettingsRepositoryImpl
import cn.edu.baiyunu.myapplication.data.repository.TransactionRepository
import cn.edu.baiyunu.myapplication.data.repository.TransactionRepositoryImpl
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

/**
 * 提供仓库相关依赖的Hilt模块
 */
@Module
@InstallIn(SingletonComponent::class)
abstract class RepositoryModule {
    
    /**
     * 绑定TransactionRepository接口到其实现
     */
    @Binds
    @Singleton
    abstract fun bindTransactionRepository(
        transactionRepositoryImpl: TransactionRepositoryImpl
    ): TransactionRepository
    
    /**
     * 绑定CategoryRepository接口到其实现
     */
    @Binds
    @Singleton
    abstract fun bindCategoryRepository(
        categoryRepositoryImpl: CategoryRepositoryImpl
    ): CategoryRepository
    
    /**
     * 绑定SettingsRepository接口到其实现
     */
    @Binds
    @Singleton
    abstract fun bindSettingsRepository(
        settingsRepositoryImpl: SettingsRepositoryImpl
    ): SettingsRepository
    
    @Binds
    @Singleton
    abstract fun bindSavingsGoalRepository(
        savingsGoalRepositoryImpl: SavingsGoalRepositoryImpl
    ): SavingsGoalRepository
} 